<?php if(!defined('APP')) die('error!');?>
<!doctype html>
<html>
<head>
    <meta charset="utf-8 ">
    <title>员工信息列表</title>
    <style>
        .box{margin: 20px;}
        .title{text-align: center;font-weight: bold;font-size: 24px;}
        table{border-collapse:collapse;width: 60%;color: #2B2B2B;margin: 20px auto;}
        table tr{border:1px solid #b5d5e6;text-align: center;height: 40px;}
        table th{font-weight: normal;background-color: #e8f6fc;}
        .search{position: relative;padding-left:59%;margin-top:20px;height:30px;width:100%;}
        .page{font-size: 14px;padding-left:68%;margin-top:20px;height:30px;width:100%;}
        .inset{font-size: 16px;padding-left:74%;margin-top:20px;height:30px;width:100%;
    </style>
</head>
<body>
<form action="showlist.php" method="GET">
<div class="box">
  <div class="title">员工信息列表</div>
  <div class="search">快速查询：<input type="text" name="keyword" /><input type="submit" value="提交" /></div><!--搜索-->
  <table border="1">
    <tr>
        <th>ID</th>
        <th>姓名</th>
        <th><a href="./showlist.php?order=e_dept&sort=<?php echo ($order=='e_dept') ? $sort : 'desc';?>">所属部门</a></th><th>出生日期</th>
        <th><a href="./showlist.php?order=date_of_entry&sort=<?php echo ($order=='date_of_entry') ? $sort : 'desc';?>">入职时间</a></th><!--排序-->
        <th width=25%>相关操作</th>
    </tr>
      <?php if(!empty($emp_info)){ ?>
          <?php foreach($emp_info as $row){ ?>
              <tr>
                  <td><?php echo $row['e_id']; ?></td>
                  <td><?php echo $row['e_name']; ?></td>
                  <td><?php echo $row['e_dept']; ?></td>
                  <td><?php echo $row['date_of_birth']; ?></td>
                  <td><?php echo $row['date_of_entry']; ?></td>
                  <td><div><span><a href="<?php echo './empUpdate.php?e_id='.$row['e_id']?>">编辑</a>&nbsp;&nbsp;<a href="<?php echo './empdelete.php?e_id='.$row['e_id']?>">删除</a></span></div></td><!--编辑-->
             </tr>
          <?php }?>
      <?php }else{ ?>
    <tr><td colspan="6">暂无员工数据</td></tr>
    <?php }  ?>
  </table>
    <div class="page"><?php echo $page_html; ?></div>
    <div class="inset"><a href="./empAdd.php">添加员工</a></div>
</div>
 </form>
</body>
</html>